<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
    <link
      rel="stylesheet"
      href="https://unpkg.com/swiper/swiper-bundle.min.css"
    />
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .swiper-container {
        width: 800px;
      }
      img {
        width: 100%;
      }
      /* .swiper_left_btnn {
        width: 18px;
        top: 50px;
        left: 600px;
      }
      .swiper_right_btnn {
        top: 50px;
        left: 50px;
      } */
    </style>
  </head>
  <body>
    <div class="swiper-container">
      <div class="swiper-wrapper">
        <div class="swiper-slide">
          <a href="#"
            ><img
              src="https://image8.wbiao.co/mall/6f2ad2a51bb9400c82282dc2a0ef5391.jpg"
              alt=""
          /></a>
        </div>
        <div class="swiper-slide">
          <a href="#"
            ><img
              src="https://image8.wbiao.co/mall/8816e6c30b0b4d298f4e6cd0f9e74839.jpg"
              alt=""
          /></a>
        </div>
        <div class="swiper-slide">
          <a href="#"
            ><img
              src="https://image8.wbiao.co/mall/79623eb5b2ae40bdb5f999227308c861.jpg"
              alt=""
          /></a>
        </div>
      </div>
      <!-- 如果需要分页器 -->
      <div class="swiper-pagination"></div>

      <!-- 如果需要导航按钮 -->

      <div class="swiper-button-prev swiper_left_btnn"></div>
      <div class="swiper-button-next swiper_right_btnn"></div>

      <!-- 如果需要滚动条 -->
      <!-- <div class="swiper-scrollbar"></div> -->
    </div>
  </body>
  <script>
    var mySwiper = new Swiper(".swiper-container", {
      //   direction: "vertical", // 垂直切换选项
      loop: true, // 循环模式选项
      effect: "fade", //切换方式

      autoplay: {
        delay: 2000,
        stopOnLastSlide: false,
        disableOnInteraction: true,
      }, //自动播放

      disableOnInteraction: false,
      simulateTouch: false, //禁止模拟触摸

      // 如果需要分页器
      pagination: {
        el: ".swiper-pagination",
      },

      // 如果需要前进后退按钮
      navigation: {
        nextEl: ".swiper-button-next",
        prevEl: ".swiper-button-prev",
      },

      // 如果需要滚动条
      //   scrollbar: {
      //     el: ".swiper-scrollbar",
      //   },
    });
    ////鼠标覆盖停止自动切换
    mySwiper.el.onmouseover = function () {
      mySwiper.autoplay.stop();
    };

    //鼠标离开开始自动切换
    mySwiper.el.onmouseout = function () {
      mySwiper.autoplay.start();
    };
  </script>
</html>
